using MinimalistFoodStreet.BackEnd.Infrastructure.EFCore;
using MinimalistFoodStreet.BackEnd.Infrastructure.Dtos.Response.Tables;
using MinimalistFoodStreet.BackEnd.Infrastructure.Tools;

namespace MinimalistFoodStreet.BackEnd.Server.Server.ResponseExtend.Tables
{
    public static class SuppliersEnitityExtend
    {
        public static ResponseSuppliersDto ToResponseDto(this Supplier entity, Account account)
        {
            return new ResponseSuppliersDto()
            {

                id = entity.SId,
                accountId = entity.SAccountId,
                shopName=entity.SShopName,
                openId = entity.SOpenId,
                address = entity.SAddress,
                announcement = entity.SAnnouncement,
                type = entity.SType,
                photo = entity.SPhoto,
                qualification = entity.SQualification,
                logo = entity.SLogo,
                enterpriseName = entity.SEnterpriseName,
                createTime = entity.SCreateTime,
                createTimeStr = Tools.TimeToString(entity.SCreateTime),
                updateTime = entity.SUpdateTime,
                updateTimeStr = Tools.TimeToString(entity.SUpdateTime),
                name = account.AName,
                account = account.AAccount,
                avatar = account.AAvatar,
                email = account.AEmail,
                endpoint = account.AEndpoint,
                isActive = account.AIsActive,
                isBan = account.AIsBan,
                phone = account.APhone,
            };
        }
    }
}